﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

namespace KTSonline
{
    public partial class Register : System.Web.UI.Page
    {
        public Boolean success = false;
        protected void Page_Load(object sender, EventArgs e)
        {
            Global.currentpage = Global.Pages.Register;
        }

        protected void btndone_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                TAI_KHOAN tk = new TAI_KHOAN();
                tk.diachi = txtAddress.Text;
                tk.dienthoai = txtPhone.Text;
                tk.email = txtEmail.Text;
                tk.gioitinh = Boolean.Parse(ddlSex.SelectedValue);
                tk.hoten = txtName.Text;
                tk.password = txtPassword.Text;
                tk.username = txtUsername.Text;

                KTSonlineDataContext db = new KTSonlineDataContext();
                db.TAI_KHOANs.InsertOnSubmit(tk);
                db.SubmitChanges();
                success = true;
            }
        }
    }
}
